package org.smartcti.freeswitch.inbound.response;

import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

public class CommandResponse {
	private String replyText;
	private String contentType;
	private boolean   success;
	private final static String determinePrefix = "OK";

	public String getReplyText() {
		return replyText;
	}

	public void setReplyText(String replyText) {
		this.replyText = replyText;
		determine(replyText);
	}

	
	
	public String getContentType() {
		return contentType;
	}

	public void setContentType(String contentType) {
		this.contentType = contentType;
	}

	public boolean isSuccess() {
		return success;
	}

	void determine(String reply) {
		if(reply!=null && reply.indexOf(determinePrefix)>=0){
			success = true;
		}else{
			success = false;
		}
		
	}
	
	
	 @Override
     public String toString() {
             return ReflectionToStringBuilder.toString(this,ToStringStyle.MULTI_LINE_STYLE);
     }
	
	
	
	
	
	
	

}
